function findNearest() : pair; // a - array of pt

	procedure swap(var a, b : pt);

	var
		t : pt;

	begin
		t := a;
		a := b;
		b := t;
	end;

	procedure sortX(l, r : longint);

	var
		i, j : longint;
		x : pt;

	begin
		i := l;
		j := r;
		x := a[l + random(r - l + 1)];
		repeat
			while (a[i].x < x.x) or ((a[i].x = x.x) and (a[i].y < x.y)) do inc(i);
			while (a[j].x > x.x) or ((a[j].x = x.x) and (a[j].y > x.y)) do dec(j);
			if i <= j then begin
				swap(a[i], a[j]);
				inc(i);
				dec(j);
			end;
		until i > j;
		if l < j then sortX(l, j);
		if i < r then sortX(i, r);
	end;   

	procedure sortY(l, r : longint);

	var
		i, j : longint;
		x : pt;

	begin
		i := l;
		j := r;
		x := a[l + random(r - l + 1)];
		repeat
			while a[i].y < x.y do inc(i);
			while a[j].y > x.y do dec(j);
			if i <= j then begin
				swap(a[i], a[j]);
				inc(i);
				dec(j);
			end;
		until i > j;
		if l < j then sortY(l, j);
		if i < r then sortY(i, r);
	end;

var
	ansA, ansB : longint;
	md : int64;
	t : array[0..10010] of pt;

	procedure updAns(a, b : pt);

	var
		cur : int64;
		
	begin
		cur := (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
		if cur < md then begin
			md := cur;
			ansA := a.id;
			ansB := b.id;
		end;
	end;

	procedure rec(l, r : longint);

	var
		i, j, m, midx, tsz : longint;
	
	begin
		if r - l <= 3 then begin
			for i := l to r do
				for j := i + 1 to r do
					updAns(a[i], a[j]);
			sortY(l, r);
			exit;
		end;
		m := (l + r) shr 1;
		midx := a[m].x;
		rec(l, m);
		rec(m + 1, r);
		sortY(l, r);
		tsz := 0;
		for i := l to r do
			if abs(a[i].x - midx) < md then begin
				j := tsz;
				while (j > 0) and (a[i].y - t[j].y < md) do begin
					updAns(a[i], t[j]);
					dec(j);
				end;
				inc(tsz);
				t[tsz] := a[i];
			end;
	end;
	
begin
	sortX(1, n);
	md := maxlongint;
	rec(1, n);
	result.a := ansA;
	result.b := ansB;	
end;